package org.zsk.cs.algorithnm;

import java.util.*;
public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            String input = sc.nextLine();

            if (input.equals("0"))
                break;

            String [] ins =input.split(" ");
            int sum=0;
            Integer a = Integer.parseInt(ins[0]);

            for (int i=0;i<a;i++){
                Integer b = Integer.parseInt(ins[i]);
                sum+=b;
            }

            System.out.println(sum);
        }
    }
}